// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Components/SceneComponent.h"
#include "Components/TextRenderComponent.h"
#include "ProceduralMeshComponent.h"
#include "Materials/MaterialInstanceDynamic.h"
#include "ProceduralSectorComponent.generated.h"


UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class VISUALCHARTFX_API UProceduralSectorComponent : public USceneComponent
{
	GENERATED_BODY()

public:	
	// Sets default values for this component's properties
	UProceduralSectorComponent();

protected:
	// Called when the game starts
	virtual void BeginPlay() override;
	virtual void OnRegister() override;

public:	
	// Called every frame
	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

	UFUNCTION(BlueprintCallable)
	void SetColor(const FLinearColor Color);

	UFUNCTION(BlueprintCallable)
	void Rebuild(float Angle, float Radius, float Height, int Precision, float Bevel, UMaterialInterface* MaterialInterface);

	UFUNCTION(BlueprintCallable)
	void SetLabel(FString Label, float Radius, float Angle, UMaterialInterface* Material);
	
protected:

	UPROPERTY(EditAnywhere, BlueprintReadOnly)
	TObjectPtr<UProceduralMeshComponent> SectorMeshComponent;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	TObjectPtr<UTextRenderComponent> TextComponent;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	TObjectPtr<UMaterialInstanceDynamic> MaterialInstance;
};
